package threads;
import java.sql.SQLException;

import Exceptions.AcabouRegistrosException;

import persistence.ConexaoMysql;
import entidades.Nota;


public class BuscaNFLock extends Thread {
	
	private ConexaoMysql conn = new ConexaoMysql();
	private Nota nota;
	private Integer venCod;
	private Integer nroLote;
	
	public BuscaNFLock(Nota nota,Integer venCod) {
		this.nota = nota;
		this.venCod = venCod;
	}

	@Override
	public void run() {
			try {
				while(true){
					conn.conecta();										
					try {
						nota.buscaNotaLock(conn, venCod);
					} catch (AcabouRegistrosException e) {
						return;
					}
					conn.desconecta();
				}
			} catch (SQLException e) {
				e.printStackTrace();
			}
	}

	public Integer getNroLote() {
		return nroLote;
	}

	public void setNroLote(Integer nroLote) {
		this.nroLote = nroLote;
	}
}
